<?php
/**
 * 关于发修
 * Author: eecjimmy
 * Date: 2015/6/22
 * Time: 16:02
 */

namespace Wap\Controller;

/**
 * Class AboutController
 * @package Wap\Controller
 */
class AboutController extends WapController
{
    function _initialize()
    {
        parent::_initialize();
    }

    function map()
    {
        C('TMPL_L_DELIM','{{');            // 模板引擎普通标签开始标记
        C('TMPL_R_DELIM', '}}');            // 模板引擎普通标签结束标记
        $brands = M('brand')->field(true)->select();

        // 条件处理
        $where = array();
        intval(I('bid')) && $where['bid'] = intval(I('bid'));

        $field = 'id, sname, address, phone, explain, lon, lat';// 字段处理
        $stores = M('store')->where($where)->field($field)->select();
        foreach($stores as &$store){
            $store['geocoder'] = "http://api.map.baidu.com/marker?location={$store['lat']},{$store['lon']}&title=".urlencode($store['sname'])."&content=".urlencode($store['address'])."&output=html&src=faxiu";
        }
        $this->assign('stores', $stores); // 分店
        $this->assign('brands', $brands); // 品牌
        $this->display();
    }
}